#include<stdlib.h>
#include<stdio.h>
#define MAXN 10
int data[MAXN] = {3,9,-1,2,6,-2,4,8,1,7};
int s[MAXN],t[MAXN],p[MAXN];

int main(){
    int i,max;
    s[0] = t[MAXN-1] = 1;
    for(i=0;i<MAXN;i++){
        if(i==0)
            s[i] = data[i];
        else
            s[i] = s[i-1]*data[i];
    }
    for(i=MAXN-1;i>=0;i--){
        if(i==MAXN-1)
            t[i] = data[i];
        else
            t[i] = t[i+1]*data[i];
    }
    for(i=0;i<MAXN;i++){
        if(i==0)
            p[i] = t[i+1];
        else if(i==MAXN-1)
            p[i] = s[i-1];
        else
            p[i] = s[i-1]*t[i+1];
    }
    max = p[0];
    for(i=1;i<MAXN;i++)
        if(p[i]>max)
            max = p[i];
    printf("%d\n",max);
    return 0;
}
